package day05;

import java.util.Scanner;

//随机加法运算
public class Addition {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int score = 0;
        for (int i = 1; i <= 10; i++) {
            int k=(int)(Math.random()*100);
            int m=(int) (Math.random()*100);
            int result=k+m;
            System.out.println("("+i+")"+k+"+"+m+"=?");
            System.out.println("算吧！");
            int answer=scan.nextInt();
            int o=0;
            if(o==5){
                break;

            }
            if (answer==result){
                System.out.println("答对了");
                score+=10;
                o++;
            }else {
                System.out.println("答错了");

            }

        }
        System.out.println("总分为：" + score);
    }
}
